package maxHeap;

import java.util.Random;

/**
 * @author noob
 * @version 1.0
 * @date 2021/3/19 7:24
 */
public class MainTest {

    public static void main(String[] args) {


        int n = 1000000;
        MaxHeap<Integer>  maxHeap = new MaxHeap<>();
        Random random = new Random();
        for (int i = 0; i < n; i++) {
            maxHeap.add(random.nextInt(Integer.MAX_VALUE));
        }
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = maxHeap.extractMax();
        }


        for (int i = 1; i < n; i++) {
            if(arr[i-1]< arr[i]){
                throw new IllegalArgumentException("error,不是有序的");
            }
        }

        System.out.println("Test MaxHeap completed.");
    }

}
